package com.gupao.javavip.gof.singleton;

/**
 * 懒汉式单例模式-线程不安全
 * <p>
 * 优点：需要用的时候再实例化，不造成资源浪费
 * 缺点：线程不安全
 */
public class LazySingletonUnsafe {
    private static LazySingletonUnsafe INSTANCE = null;

    //构造方法私有化
    private LazySingletonUnsafe() {
    }

    //提供全局访问点
    public static LazySingletonUnsafe getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new LazySingletonUnsafe();
        }
        return INSTANCE;
    }
}
